package com.wxdc.nmgyt.nmgytwydc.common;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.webkit.JavascriptInterface;

import com.just.agentwebX5.AgentWebX5;
import com.wxdc.nmgyt.nmgytwydc.activity.AddWzActivity;

/**
 * Created by Administrator on 2018/8/31.
 */

public class AddWzAndroidInterface {
    private Handler deliver = new Handler(Looper.getMainLooper());
    private AgentWebX5 agent;
    private AddWzActivity mAddWzActivity;
    private Context context;

    public AddWzAndroidInterface(AgentWebX5 agent, AddWzActivity addWzActivity, Context context) {
        this.agent = agent;
        mAddWzActivity = addWzActivity;
        this.context = context;
    }

    /**
     * 打开相册或相机
     * @param selectPicNum 可选择的图片数量
     */
    @JavascriptInterface
    public void callAndroidOpenCameraAndAlbum(final int selectPicNum){
        deliver.post(new Runnable() {
            @Override
            public void run() {
                mAddWzActivity.openAlbumAndCamera(selectPicNum);
            }
        });
    }
}
